Trace code pascal [on hold]

Posted by mghaffari on Programmers See other posts from Programmers or by mghaffari
Published on 2013-10-27T18:37:12Z Indexed on 2013/10/28 22:11 UTC
Read the original article Hit count: 274

Filed under:
|

I haven't worked with Pascal so far, and my problem is understanding the recursive aspects that prm assignment operators and how the final (correct) value is derived. Would someone please explain that line for me.

Program test(output);

FUNCTION prm(az:integer) : real;
begin
    if az = 1 then
        prm := sqrt(12)
    else
        prm := sqrt(12*prm(az-1));
end;

begin
    writeln(prm(30):0:2);
end.

© Programmers or respective owner

Related posts about recursion

Related posts about pascal